package cn.maxhou.t0001;

import cn.maxhou.t0001.impl.Add;
import cn.maxhou.t0001.impl.Division;
import cn.maxhou.t0001.impl.Multiply;
import cn.maxhou.t0001.impl.Subtract;

public class CounterFactory {

    public static Counter getInstance(String key) {
        switch (key) {
            case "+":
                return new Add();
            case "-":
                return new Subtract();
            case "*":
                return new Multiply();
            case "/":
                return new Division();
            default:
                throw new RuntimeException("运算符号非法");
        }
    }
}
